package com.flot.yazb.model.user;

import com.flot.yazb.base.model.BModel;
import com.flot.yazb.base.client.RetrofitFactory;
import com.flot.yazb.aop.stub.RMCallback;
import com.flot.yazb.aop.stub.RMResponse;
import com.flot.yazb.retrofit.service.BService;

import java.util.Map;

public class SelectFriendModel extends BModel {

    public String id;
    public String weid;
    public String mid;
    public String age;
    public String height;
    public String education;
    public String income;
    public String province;
    public String blank;
    public String createtime;

    public static void getFriendModel(String id, final Transit<SelectFriendModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .getFriendModel(id)
                .enqueue(new RMCallback<RMResponse<SelectFriendModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<SelectFriendModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }

    public static void setFriendModel(Map map, final Transit<SelectFriendModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .setFriendModel(map)
                .enqueue(new RMCallback<RMResponse<SelectFriendModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<SelectFriendModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }

}
